package randomWalkWithRestartRecommender;

import org.apache.mahout.cf.taste.common.TasteException;

import java.io.File;
import java.io.IOException;
import java.util.List;

public class Main {

    private static final String INPUT_FILENAME = "datasets/ratings.csv";
    private static final String OUTPUT_FILENAME = "datasets/result.csv";
	private static int userNum = 1;
	private static int howMany = 30;

    public static void main(String... args) {
        File groupLensRatingsFile = new File(INPUT_FILENAME);

        System.out.println("Reading ratings file info...");
        GroupLensDataModel dataModelUserItem = null;
        try {
            dataModelUserItem = new GroupLensDataModel(groupLensRatingsFile, OUTPUT_FILENAME);
        } catch (IOException e) {
            e.printStackTrace();
        }

        try {
            GroupLensRecommender a1 = new GroupLensRecommender(dataModelUserItem);
            List<Integer> result = a1.recommend(userNum, howMany);
            System.out.println("result: ");
            for (int i = 0; i < result.size(); i++) {
                System.out.println(result.get(i) + 1);
            }
        } catch (TasteException e) {
            e.printStackTrace();
        }

    }
}